/**
 * 场景过渡效果基类
 * 定义入场出场接口
 */
cc.Class({
    extends: cc.Component,

    properties: {
        target: {
            default:null,
            type:cc.Node,
            tooltip:'要进行过渡控制的目标节点',
        },
        enterCompleteEvents:{
            default:[],
            type:[cc.Component.EventHandler],
        },
        leaveCompleteEvents:{
            default:[],
            type:[cc.Component.EventHandler],
        },
    },
    onLoad(){
        this.target = this.target || this.node;
    },

    setTransitTarget(target){
        this.target = target;
    },

    enter(complete){
        //
        this._onComplete('geo-transit-enter-complete', this.enterCompleteEvents, complete);
    },

    leave(complete){
        //
        this._onComplete('geo-transit-leave-complete', this.leaveCompleteEvents, complete);
    },

    _onComplete(eventName, eventHandlers, complete){
        //
        var e = new cc.Event.EventCustom(eventName);
        e.target = this.node;
        //
        cc.Component.EventHandler.emitEvents(eventHandlers, e);
        //
        complete && complete();
    },
});
